package com.computaris.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.*;

@Entity
@Table(name = "SUBSCRIBER")
public class Subscriber implements java.io.Serializable {

	private Integer id ;
	private Integer subscriptionId;
	private Integer status;
	private String msisdn;
	private String imsi;
	private Date updatedate;
	
	private Subscription subscription;

	public Subscriber() {
		
	}

	@XmlTransient
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	@XmlAttribute(name="MSISDN")
	@Column(name = "MSISDN", nullable = false)
	public String getMsisdn() {
		return this.msisdn;
	}

	public void setMsisdn(String msisdn) {
		this.msisdn = msisdn;
	}

	@XmlAttribute(name="IMSI")
	@Column(name = "IMSI", nullable = false)
	public String getImsi() {
		return imsi;
	}

	public void setImsi(String imsi) {
		this.imsi = imsi;
	}
	
	@XmlAttribute(name="UpdateDate")
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UPDATE_DATE")
	public Date getUpdateDate() {
		return this.updatedate;
	}

	public void setUpdateDate(Date updatedate) {
		this.updatedate = updatedate;
	}
	
	@Column(name = "SUBSCRIPTION_ID", nullable = false)
	public Integer getSubscriptionId() {
		return subscriptionId;
	}

	public void setSubscriptionId(Integer subscriptionId) {
		this.subscriptionId = subscriptionId;
	}

	@XmlAttribute(name="Status")
	@Column(name = "STATUS", nullable = false)
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SUBSCRIPTION_ID", referencedColumnName = "ID",insertable = false, updatable = false, nullable = false)
	public Subscription getSubscription() {
		return this.subscription;		
	}

	public void setSubscription(Subscription subscription) {
		this.subscription = subscription;
	}


}
